package com.Daemon;

public class Demo {
    public static void main(String[] args) {
        MyThreads1 myThreads1 = new MyThreads1();
        MyThreads2 myThreads2 = new MyThreads2();
        MyThreads2 myThreads3 = new MyThreads2();

//        线程保护Daemon，当第一个前程结束时，被保护的线程也会随之结束
        myThreads2.setDaemon(true);
        myThreads1.setName("一号");
        myThreads2.setName("二号");
        myThreads1.start();
        myThreads2.start();
//        myThreads3.start();
    }
}
